import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { WorkRecordVO, WorkRecordForm, WorkRecordQuery } from '@/leadmall/api/workRecord/types';

/**
 * 查询汇报工作发送记录列表
 * @param query
 * @returns {*}
 */

export const listWorkRecord = (query?: WorkRecordQuery): AxiosPromise<WorkRecordVO[]> => {
  return request({
    url: PORT +'/leadmall/workRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询汇报工作发送记录详细
 * @param id
 */
export const getWorkRecord = (id: string | number): AxiosPromise<WorkRecordVO> => {
  return request({
    url: PORT +'/leadmall/workRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增汇报工作发送记录
 * @param data
 */
export const addWorkRecord = (data: WorkRecordForm) => {
  return request({
    url: PORT +'/leadmall/workRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改汇报工作发送记录
 * @param data
 */
export const updateWorkRecord = (data: WorkRecordForm) => {
  return request({
    url: PORT +'/leadmall/workRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除汇报工作发送记录
 * @param id
 */
export const delWorkRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/workRecord/' + id,
    method: 'delete'
  });
};
